<!doctype html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>admin2.0</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta http-equiv="Cache-Control" content="no-siteapp" />
        <link rel="stylesheet" href="./css/font.css">
        <link rel="stylesheet" href="./css/xadmin.css">
        <script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
        <script src="js/echarts.min.js"></script>
    </head>
    <body>
        <div class="x-body">
            <!-- 为 ECharts 准备一个具备大小（宽高）的 DOM -->
            <div id="main" style="width: 100%;height:400px;"></div>
        </div>
        <script type="text/javascript">
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));
        var categories=new Array();
        var data=new Array();
		$.ajax({
			type:"get",
			url:"/orders/analysisEveryday",
			async:false,
			success:function(res){
				for (let i=0;i<res.length;i++) {
					categories.push(res[i].lookDate);
					data.push(res[i].everydayNum);
				}
			}
		});
		
        // 指定图表的配置项和数据
        var option = {
            title: {
                text: '预约量'
            },
            tooltip: {
                trigger: 'axis'
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            toolbox: {
                feature: {
                    saveAsImage: {}
                }
            },
            xAxis: {
                type: 'category',
                boundaryGap: false,
                data: categories
            },
            yAxis: {
                type: 'value'
            },
            series: [
                {
                    name:'预约量',
                    type:'line',
                    smooth: true,
                    stack: '总量',
                    data:data
                }
            ]
        };
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    </script>
    </body>
</html>